package binaryTree;

import beans.TreeNode;

public class TreeScan {

    public static void prevScan(TreeNode node) {
        if (node == null) {
            System.out.print("null,");
            return;
        }
        System.out.print(node.val + ",");
        prevScan(node.left);
        prevScan(node.right);
    }

    public static void midScan(TreeNode node) {
        if (node == null) {
            System.out.print("null,");
            return;
        }
        midScan(node.left);
        System.out.print(node.val + ",");
        midScan(node.right);
    }

    public static void suffixScan(TreeNode node) {
        if (node == null) {
            System.out.print("null,");
            return;
        }
        suffixScan(node.left);
        suffixScan(node.right);
        System.out.print(node.val + ",");
    }
}
